﻿/**
 * ...
 * @author sminutoli
 */
import com.dmotiko.prune.*
import com.dmotiko.general.*
import com.dmotiko.lib.*
import mx.transitions.easing.*;
import mx.transitions.*;
import mx.utils.*;

class GiftSection extends Section
{
	private var sun_listener:Function;
	
	private function initClip():Void {
		Site.getApp().log( "GiftSection.as | initClip" );
		super.initClip();
		sun_listener = Delegate.create(this, sun_hidden);	
		Site.getApp().addEventListener( WebSite.SECTION_CHANGED, Delegate.create( this, section_changed ) );
	}
	
	private function section_changed(e):Void 
	{
		if ( e.section == SiteSections.GIFT ) {
			Site.getApp().getClips().getSol().addEventListener( BaseClipEvent.CHANGED, sun_listener );			
			
		} else {
			hide();7
		}
	}
	
	private function sun_hidden():Void 
	{
		if ( Site.getApp().getSection() != SiteSections.GIFT ) return;
		Site.getApp().getClips().getSol().removeEventListener( BaseClipEvent.CHANGED, sun_listener );
		show();
	}
	
}